package com.aierkeji.call.b2c.controller;

import java.util.Map;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.aierkeji.call.b2c.contants.Contants;
import com.aierkeji.call.b2c.service.AkjCallEnterpriseService;

@RestController
@RequestMapping("enterprise")
public class AkjCallEnterpriseController extends BaseController{
	
	private final Logger log = LogManager.getLogger(getClass());
	
	@Autowired
	AkjCallEnterpriseService akjCallEnterpriseService;
	
	
	/**
	 * 注册企业
	 * @param map
	 * @return
	 */
	
	@PostMapping("registerEnterprise")
	public Map<String, Object> registerEnterprise(@RequestBody  Map<String, Object> map) {
		
		return akjCallEnterpriseService.registered(map);
	}
	
	
	/**
	 * 加入企业
	 * @param map
	 * @return
	 */
	
	@PostMapping("joinEnterprise")
	//增加了这个注解就可以角色控制
    //@RequiresRoles(value= { Contants.ROLE_ID_MANAGER,Contants.ROLE_ID_SALES},logical=Logical.OR)
	public Map<String, Object> joinEnterprise(@RequestBody  Map<String, Object> map) {
		
		return akjCallEnterpriseService.joinEnterprise(map);
	}
	/**
	 * 查询企业
	 * @param map
	 * @return
	 */
	@PostMapping("findEnterprise")
	//增加了这个注解就可以角色控制
   // @RequiresRoles(value= { Contants.ROLE_ID_ADMIN,Contants.ROLE_ID_SALES},logical=Logical.OR)
	public Map<String, Object> findEnterprise(@RequestBody  Map<String, Object> map) {
		
		return akjCallEnterpriseService.findEnterprise(map);
	}
	
	/**
	 * 更新企业
	 * @param map
	 * @return
	 */
	@PostMapping("updateEnterprise")
	public Map<String, Object> updateEnterprise(@RequestBody  Map<String, Object> map) {
		
		return akjCallEnterpriseService.updateEnterprise(map);
	}
	

}
